package com.mobile.tools;


public class ArraysUtil{
	/**
	 * 把数组拼凑成字符串
	 * @param objs		要拼凑的数组对象
	 * @param separator	分隔符
	 * @return
	 */
	public static String join(Object[] objs,String separator){
		StringBuffer content = new StringBuffer();
		
		int j=0;
		
		for(Object obj:objs){
			
			content.append(obj.toString());
			
			if(j+1!=objs.length){
				content.append(separator);
			}
		}
		return content.toString();
	}
	/**
	 * 把数组拼凑成字符串,默认的分隔符为","
	 * @param objs		要拼凑的数组对象
	 * @return
	 */
	public static String join(Object[] objs) {
		StringBuffer content = new StringBuffer();

		int j = 0;

		for (Object obj : objs) {

			content.append(obj.toString());

			if (j + 1 != objs.length) {
				content.append(",");
			}
		}
		return content.toString();
	}
}
